{%if patchset.url%}
  <div>
    Downloaded from: <a href="{{patchset.url}}">{{patchset.url}}</a>
  </div>
{%endif%}
<div class="issue-list">

  <div class="pagination">
    <div style="float: left;">
      <i>Created:</i> {{patchset.created|timesince}} ago
    </div>
    <div style="float: right;">
      {%if patchset.data%}
        Download
          <a href="{%url codereview.views.download issue.key.id,patchset.key.id%}"
            title="Patchset in text format">[raw]</a>
          <a href="{%url codereview.views.tarball issue.key.id,patchset.key.id%}"
            title="Tarball containing the original and patched files">[tar.bz2]</a>
      {% else %}
        <span class="disabled">(Patch set is too large to download)</span>
      {% endif %}
      {%ifnotequal 1 num_patchsets%}
        {%if is_editor %}
        <form method="post" action="{%url codereview.views.delete_patchset issue.key.id patchset.key.id %}">
          <input type="hidden" name="xsrf_token" value="{{xsrf_token}}">
          <input type="hidden" name="_method" value="delete" />
          |
          <input onclick="return confirm('Are you sure?');"
                 type="submit" value="Delete" class="link-to"/>
        </form>
        {%endif%}
      {%endifnotequal%}
    </div>
    <div style="clear:both;"></div>
  </div>

  <table id="queues" style="clear:both;">
    <tr align="left">
      <th colspan="2"></th>
      <th>Unified diffs</th>
      <th>Side-by-side diffs</th>
      <th>Delta from patch set</th>
      <th colspan="3">Stats <font style='font-weight: normal'>(<i>+{{patchset.total_added}} line{{patchset.total_added|pluralize}}, -{{patchset.total_removed}} line{{patchset.total_removed|pluralize}}</i>)</font></th>
      <th>Patch</th>
    </tr>

    {%for patch in patchset.patches%}
      <tr name="patch">
        <td class="first" width="14"><img src="{{media_url}}closedtriangle.gif"
    style="visibility: hidden;" width="12" height="9" /></td>
        <td style="white-space: nowrap">{%if patch.status%}{{patch.status}}{%endif%}</td>
        <td>
          <a class="noul"
             href="{%url codereview.views.patch issue.key.id,patchset.key.id,patch.key.id%}">
            {{patch.filename}}
          </a>
        </td>
        <td>
          <a class="noul"
             href="{%url codereview.views.diff issue.key.id,patchset.key.id,patch.filename%}">
            View
          </a>
        </td>
        <td style="white-space: nowrap">
        {%for delta in patch.parsed_deltas%}
          <a href="{%url codereview.views.diff2 issue.key.id,delta.1,patchset.key.id,patch.filename%}"
             title="Delta from patch set {{delta.0}}">{{delta.0}}</a>
        {%endfor%}
        </td>
        {%if patch.is_binary%}
          <td style="white-space: nowrap" colspan="2"><i>Binary file</i></td>
        {%else%}
          <td style="white-space: nowrap">{{patch.num_chunks}} chunk{{patch.num_chunks|pluralize}}</td>
          <td style="white-space: nowrap">+{{patch.num_added}} line{{patch.num_added|pluralize}}, -{{patch.num_removed}} line{{patch.num_removed|pluralize}}</td>
        {%endif%}
        <td style="white-space: nowrap">
          {%if patch.num_comments or patch.num_drafts%}<b>{%endif%}
            {{patch.num_comments}} comment{{patch.num_comments|pluralize}}
            {%if patch.num_my_comments%}
              ({{patch.num_my_comments}} by me)
            {%endif%}
            {%if patch.num_drafts%}
            <span style="color:red">+
              {{patch.num_drafts}} draft{{patch.num_drafts|pluralize}}
            </span>
            {%endif%}
          {%if patch.num_comments or patch.num_drafts%}</b>{%endif%}
        </td>
        <td>
          <a href="{%url codereview.views.download_patch issue.key.id,patchset.key.id,patch.key.id%}"
             title="Download patch for {{patch.filename}}">
            Download
          </a>
        </td>
      </tr>
    {%endfor%}

  </table>
</div>
